package co.fitstart.entity.user.investigation;

import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.apache.commons.lang3.StringUtils;
import org.hibernate.annotations.DynamicUpdate;

import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

import co.fitstart.entity.user.User;

/**
 * 
 * @author mohanlan
 *
 */
@Entity
@Table(name = "profile_investigation")
@DynamicUpdate
@JsonIgnoreProperties(value={"hibernate_lazy_initializer","handler","fieldHandler"})
public class ProfileInvestigation {
    
    @Id
    @GeneratedValue
    private Long id;
    
    @ManyToOne(fetch = FetchType.LAZY, optional = false)
    @JSONField(serialize = false)
    private User user;
    
    /** 创建时间 */
    private Date createTime;
    
    /** 微信二维码路径 */
    private String qrcodePath;
    
    /** 微信号*/
    private String wechatCode;
    
    /** 邮箱*/
    private String mailbox;
    
    /** 国 */
    private String country;
    
    /** 省 */
    private String province;
    
    /** 市  */
    private String region;
    
    /** 区 */
    private String district;
    
    /** 地址 */
    private String address;
    
    /** 职位 */
    private String position;
    
    /** 薪资范围 */
    private String salary;
    
    /** 个人信息备注 */
    private String remarks;
    
    /**
     * The default constructor
     */
    public ProfileInvestigation() {
    }

    /**
     * 
     * @return
     */
    public ProfileInvestigation initialize() {
        this.createTime = new Date();
        return this;
    }

    /**
     * 
     * @param profileInvestigation
     * @return
     */
    public ProfileInvestigation edit(ProfileInvestigation profileInvestigation) {
        
        if(StringUtils.isNoneEmpty(profileInvestigation.getQrcodePath())) {
            this.qrcodePath = profileInvestigation.getQrcodePath();
        }
        
        this.wechatCode = profileInvestigation.getWechatCode();
        this.mailbox = profileInvestigation.getMailbox();
        this.country = profileInvestigation.getCountry();
        this.province = profileInvestigation.getProvince();
        this.region = profileInvestigation.getRegion();
        this.district = profileInvestigation.getDistrict();
        this.address = profileInvestigation.getAddress();
        this.position = profileInvestigation.getPosition();
        this.salary = profileInvestigation.getSalary();
        this.remarks = profileInvestigation.getRemarks();
        
        return this;
    }

    /**
     * 
     * @param user
     * @return
     */
    public ProfileInvestigation bindUser(User user) {
        this.user = user;
        return this;
    }

    /**
     * 
     * @param qrcodePath
     * @return
     */
    public ProfileInvestigation editQrcodePath(String qrcodePath) {
        this.qrcodePath = qrcodePath;
        return this;
    }

    /**
     * @return the id
     */
    public Long getId() {
        return id;
    }

    /**
     * @return the user
     */
    public User getUser() {
        return user;
    }

    /**
     * @return the createTime
     */
    public Date getCreateTime() {
        return createTime;
    }

    /**
     * @return the qrcodePath
     */
    public String getQrcodePath() {
        return qrcodePath;
    }

    /**
     * @return the wechatCode
     */
    public String getWechatCode() {
        return wechatCode;
    }

    /**
     * @return the mailbox
     */
    public String getMailbox() {
        return mailbox;
    }

    /**
     * @return the country
     */
    public String getCountry() {
        return country;
    }

    /**
     * @return the province
     */
    public String getProvince() {
        return province;
    }

    /**
     * @return the region
     */
    public String getRegion() {
        return region;
    }

    /**
     * @return the district
     */
    public String getDistrict() {
        return district;
    }

    /**
     * @return the address
     */
    public String getAddress() {
        return address;
    }

    /**
     * @return the position
     */
    public String getPosition() {
        return position;
    }

    /**
     * @return the salary
     */
    public String getSalary() {
        return salary;
    }

    /**
     * @return the remarks
     */
    public String getRemarks() {
        return remarks;
    }

    /**
     * @param id the id to set
     */
    public void setId(Long id) {
        this.id = id;
    }

    /**
     * @param user the user to set
     */
    public void setUser(User user) {
        this.user = user;
    }

    /**
     * @param createTime the createTime to set
     */
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    /**
     * @param qrcodePath the qrcodePath to set
     */
    public void setQrcodePath(String qrcodePath) {
        this.qrcodePath = qrcodePath;
    }

    /**
     * @param wechatCode the wechatCode to set
     */
    public void setWechatCode(String wechatCode) {
        this.wechatCode = wechatCode;
    }

    /**
     * @param mailbox the mailbox to set
     */
    public void setMailbox(String mailbox) {
        this.mailbox = mailbox;
    }

    /**
     * @param country the country to set
     */
    public void setCountry(String country) {
        this.country = country;
    }

    /**
     * @param province the province to set
     */
    public void setProvince(String province) {
        this.province = province;
    }

    /**
     * @param region the region to set
     */
    public void setRegion(String region) {
        this.region = region;
    }

    /**
     * @param district the district to set
     */
    public void setDistrict(String district) {
        this.district = district;
    }

    /**
     * @param address the address to set
     */
    public void setAddress(String address) {
        this.address = address;
    }

    /**
     * @param position the position to set
     */
    public void setPosition(String position) {
        this.position = position;
    }

    /**
     * @param salary the salary to set
     */
    public void setSalary(String salary) {
        this.salary = salary;
    }

    /**
     * @param remarks the remarks to set
     */
    public void setRemarks(String remarks) {
        this.remarks = remarks;
    }
}
